package user;

import book.BookList;

import java.util.Scanner;

/**
 * @program: 11.22
 * @description:
 * @author: 李鑫月
 * @create: 2021-11-22 21:39
 **/
public class Main {
    public static User login(){
        System.out.println("请输入您的姓名：");
        Scanner scanner=new Scanner(System.in);
        String name=scanner.nextLine();
        System.out.println("请选择您的身份：");
        System.out.println("1.管理员  2.用户");
        int choice=scanner.nextInt();
        if(choice==1){
            Admin admin=new Admin(name);
            return admin;
        }
        else {
            Normal normal=new Normal(name);
            return normal;
        }
    }
    public static void main(String[] args) {
        BookList bookList=new BookList();
        User user=login();
        while (true){

            int choice=user.menu();
            user.iOperations[choice].work(bookList);
        }

    }
}
